﻿using System;
using System.Collections.Generic;

namespace PotatoSoft
{
    namespace VOCTS
    {
        namespace Workbench
        {
            public class Project
            {
                public Int32 ProjectID { get; set; }
                public string ProjectName { get; set; }
                public ICollection<Examination> ProjectExaminations { get; set; }

                //FKs and Reference properties/value objects
                public int WorkspaceID { get; set; }
                private Workspace _workspace;
                public Workspace Workspace
                {
                    get { return _workspace; }
                    set
                    {
                        _workspace = value;
                        //explicit relationship fixup
                        _workspace.AddProject(this);
                    }

                }

                public void AddExamination(Examination ex)
                {
                    if (ProjectExaminations == null)
                    {
                        ProjectExaminations = new List<Examination>();
                    }

                    if (!ProjectExaminations.Contains(ex))
                    {
                        ProjectExaminations.Add(ex);
                    }

                    if (ex.Project != this)
                    {
                        ex.Project = this;
                    }
                }  
            }
        }
    }
}
